﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OrganizeYourSearch.Helpers
{
    public static class FileNameHelper
    {
        public static string GetFileNameOnlyWithoutExtension(string completeFilePath)
        {
            int start = completeFilePath.LastIndexOf('\\')+1;
            string onlyFileName = completeFilePath.Substring(start);
            return RemoveExension(onlyFileName);

        }

        public static string GetFileNameOnlyWithExtension(string completeFilePath)
        {
            int start = completeFilePath.LastIndexOf('\\')+1;
            string onlyFileName = completeFilePath.Substring(start);
            return onlyFileName;
        }

        /// <summary>
        /// Gets compete file path and removes file extension from the path string
        /// </summary>
        /// <param name="completeFilePath">Complete File Path</param>
        /// <returns>filepath with filename, but withouth extension</returns>
        public static string GetFilePathWithFileNameWithoutExtension(string completeFilePath)
        {
            return RemoveExension(completeFilePath);
        }

        public static string RemoveExension(string withExtension)
        {
            string editedFilePath = withExtension.Remove(withExtension.LastIndexOf('.'));
            return editedFilePath;
        }

        public static string ConstructFullFilePath(string fileName, string extension, string directoryPath)
        {
            throw new Exception();
        }
    }
}
